package com.TeamJigsaw.DanteTrail.Models;

import java.util.Random;

public class SevereStromEvent extends RandomEvent {

	private Random generator;
	
	private String eventMessage;
	
	public SevereStromEvent () {
		
		generator = new Random ();
		eventMessage = null;
		
	}
	
	@Override
	public boolean performEvent(Party party) {
		int randNum = generator.nextInt(101);
		int pace = party.getPace();
		double multiply = 0.00;
		if (pace == 5){
			multiply = 1.20;
		}
		else if (pace == 10){
			multiply = 1.15;
		}
		else if (pace == 15){
			multiply = 1.10;
		}
		else if (pace == 20){
			multiply = 1.05;
		}
		
		double newRand = randNum * multiply;
		
		if (newRand > 100){
			eventMessage = "There is a severe storm in your area. " +
					"You are forced to take cover and stay put for 3 days. " +
					"You still consumed food during those days.";
			int foodLost = party.getRations() * 3;
			party.addFood(-foodLost);
			return true;
		}
		
		return false;
	}

	@Override
	public String getMessage() {
		return eventMessage;
	}

}
